<template>
  <div class="login-container">
    <div class="login-box">
      <h2>AI-智周万物 登录</h2>
      <el-form :model="loginForm" class="login-form">
        <el-form-item>
          <el-input v-model="loginForm.username" placeholder="请输入用户名" />
        </el-form-item>
        <el-form-item>
          <el-input v-model="loginForm.password" type="password" placeholder="请输入密码" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleLogin" :loading="loading" style="width:100%">登录</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()
const loginForm = ref({ username: '', password: '' })
const loading = ref(false)

function handleLogin() {
  loading.value = true
  setTimeout(() => {
    loading.value = false
    // 模拟登录成功，跳转首页
    router.push('/home')
  }, 1000)
}
</script>

<style scoped>
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0e7ff 0%, #f8fafc 100%);
}
.login-box {
  background: #fff;
  padding: 40px 32px;
  border-radius: 16px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.08);
  width: 360px;
}
.login-form {
  margin-top: 24px;
}
</style> 